/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * supervision_rh_asistencia_checador.java
 *
 * Created on 2/09/2013, 02:36:45 PM
 */

package si_rhchecador;


import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
import java.text.ParseException;
//import java.text.*;
import org.jdom.*;
import org.jdom.output.*;
import org.jdom.input.*;
import java.io.*;
import java.text.DecimalFormat;
import java.util.*;


/**
 *
 * @author michelle
 */
public class supervision_rh_asistencia_checador extends javax.swing.JFrame {
       si_conexion x = new si_conexion();
    ResultSet rs = null;
    private Element xmlRaiz=new Element("checados");
    private javax.swing.table.DefaultTableModel jtable_modelo_checlocal;
    private javax.swing.table.DefaultTableModel jtable_modelo_asistenciaxdia_detalle;
    private javax.swing.table.DefaultTableModel jtable_modelo_asistenciaxdia;
    private DefaultListModel modelo ;

    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private int sihayregistros=0,indice=0,carga=0;

    /** Creates new form supervision_rh_asistencia_checador */
    public supervision_rh_asistencia_checador() {
            this.iniciar_modelo_checklocales();
        this.iniciar_modelo_asistencia_detalle();
        this.iniciar_modelo_asistencia();
        this. iniciar_modelo_depaenlista();
        initComponents();
             this.jtf_observacion.requestFocus();
        this.cargar_datos_checklocales();
        carga=1;


        Calendar fechaini = Calendar.getInstance(); // obtiene la fecha actual
        this.jdc_fechaingreso.setDate(fechaini.getTime());


        Calendar fechainisem = Calendar.getInstance(); // obtiene la fecha actual
        Calendar fechafinsem = Calendar.getInstance(); // obtiene la fecha actual
        int diadesemana=fechainisem.get(Calendar.DAY_OF_WEEK)-2;

        System.out.println(diadesemana);
        fechainisem.add(Calendar.DATE, -diadesemana); // incrementa en 30 días la fecha actual.
        this.jdc_fechainicial.setDate(fechainisem.getTime());

        fechafinsem.add(Calendar.DATE, (6-diadesemana)); // incrementa en 30 días la fecha actual.
        this.jdc_fechafinal.setDate(fechafinsem.getTime());
        this.jtf_tiendaactual.setText(si_variables.getdepartamento()+":"+si_variables.getdepartamento());


        jt_historialasistencia_detalle1.getColumnModel().getColumn(0).setPreferredWidth(10);//tem ent
        jt_historialasistencia_detalle1.getColumnModel().getColumn(1).setPreferredWidth(65);//familia
        jt_historialasistencia_detalle1.getColumnModel().getColumn(2).setPreferredWidth(70);//subfam.
        jt_historialasistencia_detalle1.getColumnModel().getColumn(3).setPreferredWidth(10);//tem ent
        jt_historialasistencia_detalle1.getColumnModel().getColumn(4).setPreferredWidth(10);//familia
        jt_historialasistencia_detalle1.getColumnModel().getColumn(5).setPreferredWidth(40);//subfam.
        jt_historialasistencia_detalle1.getColumnModel().getColumn(6).setPreferredWidth(20);//tem ent
        jt_historialasistencia_detalle1.getColumnModel().getColumn(7).setPreferredWidth(10);//tem ent
        jt_historialasistencia_detalle1.getColumnModel().getColumn(8).setPreferredWidth(30);//tem ent
        jt_historialasistencia_detalle1.getColumnModel().getColumn(9).setPreferredWidth(5);//tem ent
        jt_historialasistencia_detalle1.getColumnModel().getColumn(10).setPreferredWidth(30);//tem ent

        jt_historialasistencia_detalle.getColumnModel().getColumn(0).setPreferredWidth(10);//tem ent
        jt_historialasistencia_detalle.getColumnModel().getColumn(1).setPreferredWidth(65);//familia
        jt_historialasistencia_detalle.getColumnModel().getColumn(2).setPreferredWidth(70);//subfam.
        jt_historialasistencia_detalle.getColumnModel().getColumn(3).setPreferredWidth(10);//tem ent
        jt_historialasistencia_detalle.getColumnModel().getColumn(4).setPreferredWidth(10);//familia
        jt_historialasistencia_detalle.getColumnModel().getColumn(5).setPreferredWidth(40);//subfam.
        jt_historialasistencia_detalle.getColumnModel().getColumn(6).setPreferredWidth(20);//tem ent
        jt_historialasistencia_detalle.getColumnModel().getColumn(7).setPreferredWidth(10);//tem ent
        jt_historialasistencia_detalle.getColumnModel().getColumn(8).setPreferredWidth(30);//tem ent
        jt_historialasistencia_detalle.getColumnModel().getColumn(9).setPreferredWidth(5);//tem ent
        jt_historialasistencia_detalle.getColumnModel().getColumn(10).setPreferredWidth(30);//tem ent
    }

    private void iniciar_modelo_checklocales()
    {
        jtable_modelo_checlocal=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_checlocal.addColumn("<html><b>Codigo</b></html>");
        jtable_modelo_checlocal.addColumn("<html><b>Fecha</b></html>");
        jtable_modelo_checlocal.addColumn("<html><b>Hora</b></html>");
        jtable_modelo_checlocal.addColumn("<html><b>Observacion</b></html>");
        jtable_modelo_checlocal.addColumn("<html><b>Nombre</b></html>");
    }
private void iniciar_modelo_asistencia_detalle()
    {
        jtable_modelo_asistenciaxdia_detalle=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Colaborador</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Fecha</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Status</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Hora E.</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Hora S.</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Min. Comida</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Hrs Trab.</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Observaciones</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Status Revision</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Id</b></html>");
        jtable_modelo_asistenciaxdia_detalle.addColumn("<html><b>Puntualidad</b></html>");

    }
 private void iniciar_modelo_asistencia()
    {
        jtable_modelo_asistenciaxdia=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_asistenciaxdia.addColumn("<html><b>Departamento</b></html>");
        jtable_modelo_asistenciaxdia.addColumn("<html><b>Nombre</b></html>");
    }

private void cargar_datos_checklocales()
        {
        while(jtable_modelo_checlocal.getRowCount()>0)jtable_modelo_checlocal.removeRow(0);
               try
                    {
                        File archivo = new File(this.jtf_unidadlocal.getText().toUpperCase().replace(":", "")+":/sichecadoslocal.xml");
                        if (archivo.exists())
                            {
                                SAXBuilder cons=new SAXBuilder();
                                Document doc = cons.build(archivo);
                                Element xmlRaiz=doc.getRootElement();
                                java.util.List checados =xmlRaiz.getChildren("chequeo");
                                Iterator iter =checados.iterator();
                                while(iter.hasNext())
                                    {
                                        sihayregistros=1;
                                        Element checado=(Element) iter.next();
                                        Element eidcodigo=checado.getChild("idcodigo");
                                        Element efecha=checado.getChild("fecha");
                                        Element ehora=checado.getChild("hora");
                                        Element eobservacion=checado.getChild("observacion");
                                        Element enombre=checado.getChild("nombre");
                                        jtable_modelo_checlocal.addRow(new Object[]{eidcodigo.getText(),this.fechaeuropea(efecha.getText()),ehora.getText(),eobservacion.getText(),enombre.getText()});
                                    }
                            }
                    }
                    catch (Exception ex)
                        {
                            ex.printStackTrace();
                        }
        }
private void datos_checklocales_update()
        {
               try
                    {
                        File archivo = new File(this.jtf_unidadlocal.getText().toUpperCase().replace(":", "")+":/sichecadoslocal.xml");
                        if (archivo.exists())
                            {
                                SAXBuilder cons=new SAXBuilder();
                                Document doc = cons.build(archivo);
                                Element xmlRaiz=doc.getRootElement();
                                java.util.List checados =xmlRaiz.getChildren("chequeo");
                                Iterator iter =checados.iterator();
                                while(iter.hasNext())
                                    {
                                        Element checado=(Element) iter.next();
                                        Element eidcodigo=checado.getChild("idcodigo");
                                        Element efecha=checado.getChild("fecha");
                                        Element ehora=checado.getChild("hora");
                                        Element eobservacion=checado.getChild("observacion");
                                        Element enombre=checado.getChild("nombre");
                                        try
                                             {
                                                rs = x.sieuno_executediversosv2("select * from x1_supervision_empleados_asistencia_insert_local('"+eidcodigo.getText().trim()+"','Reg. Local"+eobservacion.getText().trim()+"','"+efecha.getText().trim()+"','"+ehora.getText().trim()+"');",si_variables.getconexiongral());
                                                while (rs.next())
                                                    {
                                                    switch (rs.getInt(1))
                                                        {
                                                            case 1:
                                                                JOptionPane.showMessageDialog(null," Codigo no Existe","Sistema Integral(Chequeo Asistencia) : Ayuda",1);
                                                                this.avisos_add("3",enombre.getText()+":"+eidcodigo.getText().trim()+":"+eobservacion.getText().trim()+":"+efecha.getText().trim()+":"+ehora.getText().trim()+"",efecha.getText().trim());
                                                            break;
                                                        }
                                                    }
                                              }
                                        catch(Exception e)
                                                {
                                                    System.out.println(e.getMessage());
                                                }
                                    }
                            }
                        archivo.delete();
                        sihayregistros=0;
                    }
                    catch (Exception ex)
                        {
                            ex.printStackTrace();
                        }
        }

 private void iniciar_modelo_depaenlista()
    {
        modelo = new javax.swing.DefaultListModel();
      
    }
private void iniciar_modelo_depaenlistac()
    {

        try
            {
               rs = x.sieuno_executediversosv2("select * from x1_supervision_tareas_departamentos() as (id smallint,descrip character varying(80));",si_variables.getconexiongral());
               while (rs.next())
                    {
                          modelo.addElement(rs.getString("id")+":"+rs.getString("descrip"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }



 private void iniciar_modelo_columnas(Date fechaInicial, Date fechaFinal)
    {
     String titulo="";
     int columnas =0,i=0,j=0;
     columnas=this.jt_historialasistencia.getColumnModel().getColumnCount();
     System.out.println("columnas"+columnas);

     int candias=this.fechasDiferenciaEnDias(fechaInicial, fechaFinal)+3;

     System.out.println("revision de columnas"+columnas+" diferencia fechas"+candias);
     for(j=columnas;j<candias;j++)
                {
                  //  this.Removecolumna(jtb_asitencia, columnas-j);
                      jtable_modelo_asistenciaxdia.addColumn(j);
                     // System.out.println("Agrego ahora hay"+j+"="+this.jtb_asitencia.getColumnModel().getColumnCount());
                }
     Calendar fechaini = Calendar.getInstance(); // obtiene la fecha actual
      for(i=2;i<candias;i++)
                {
                    fechaini.set(fechaInicial.getYear()+1900,fechaInicial.getMonth(),fechaInicial.getDate()+(i-2));
                    System.out.println("esto vale i"+i+"estovale dias"+candias);
                    titulo=this.fechaeuropea(fechaini.getTime());
                    jt_historialasistencia.getColumnModel().getColumn(i).setHeaderValue(titulo+" "+this.DiaSemana(this.fechaamericana(titulo)).substring(0, 2));
                }
                //jtb_asitencia.repaint();

    }


 private int fechasDiferenciaEnDias(Date fechaInicial, Date fechaFinal) {

      Calendar grefechamesini = Calendar.getInstance(); // obtiene la fecha actual
       grefechamesini.set(fechaInicial.getYear()+1900,fechaInicial.getMonth(),fechaInicial.getDate());
      Calendar grefechamesfin = Calendar.getInstance(); // obtiene la fecha actual
      grefechamesfin.set(fechaFinal.getYear()+1900,fechaFinal.getMonth(),fechaFinal.getDate());

     int dias=grefechamesfin.get(Calendar.DAY_OF_YEAR)-grefechamesini.get(Calendar.DAY_OF_YEAR);
     /*
        DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
        String fechaInicioString = df.format(fechaInicial);
            try {
                fechaInicial = df.parse(fechaInicioString);
                }
                catch (ParseException ex) {
                }

        String fechaFinalString = df.format(fechaFinal);
                try {
                    fechaFinal = df.parse(fechaFinalString);
                    }
                catch (ParseException ex) {
                    }

            long fechaInicialMs = fechaInicial.getTime();
            long fechaFinalMs = fechaFinal.getTime();
            long diferencia = fechaFinalMs - fechaInicialMs;
            double dias = Math.floor(diferencia / (1000 * 60 * 60 * 24));
      */
            return dias;
    }


private void carga_datos_asistencia_detalle(int opcion,String busca1,String busca2,String busca3)
    {
    //invoco al metodo que trae el recordset de datos
    int encontro=0,minutos=0;
    DecimalFormat myFormat2 = new DecimalFormat("############");
    String nombree=null,idrealiza="",texto="",id="",tiempo[]=null;
    while(jtable_modelo_asistenciaxdia_detalle.getRowCount()>0)jtable_modelo_asistenciaxdia_detalle.removeRow(0);
     Object[] fnewRow = new Object[11];
     texto="select * from x1_supervision_empleados_asistencia_catalogo("+opcion+",'"+busca1+"','"+busca2+"','"+busca3+"') as (id integer,fechaasiste date,idempleado integer,horaentrada time,horasalida time,idstatus smallint,observaciones text,iddepartamento smallint,idstatusconfirma smallint,nombreempleado character varying(50),nombrepat character varying(50),nombremat character varying(50),statusdescribe text,describedepa character varying(80),statusconfirmacion text,horastrab interval,mincomida interval,idpuntual smallint,despun text,hep time,hsp time,hecp time,hscp time,mincomp smallint);";
     System.out.println(texto);
    try
        {
         rs = x.sieuno_executediversosv2(texto,si_variables.getconexiongral());
            while (rs.next())
                {
                    encontro=1;
                    nombree=rs.getString("nombreempleado")+" "+rs.getString("nombrepat")+" "+rs.getString("nombremat");
                    fnewRow[0]=nombree;
                    id=rs.getString("idempleado");
                    this.jtf_nombrecolaboradorprogramado.setText(nombree);
                    this.jtf_id.setText(rs.getString("id"));
                    fnewRow[1]="<html><p align=justify>"+this.fechaeuropea(rs.getString("fechaasiste"))+" "+this.DiaSemana(this.fechaeuropea(rs.getString("fechaasiste"))).substring(0, 3)+"</p></html>";
                    fnewRow[2]=rs.getString("idstatus")+":"+rs.getString("statusdescribe");
                    fnewRow[3]=rs.getString("horaentrada").substring(0,5)+"("+rs.getString("hep").substring(0,5)+")";
                    fnewRow[4]=rs.getString("horasalida").substring(0,5);
                      if((rs.getString("horastrab")!=null)&&(!rs.getString("horasalida").substring(0, 5).equals("00:00")))
                    {
                        tiempo=rs.getString("mincomida").split(":");
                        minutos=(Integer.valueOf(tiempo[0])*60)+(Integer.valueOf(tiempo[1]));
                        fnewRow[5]=myFormat2.format(minutos)+"("+rs.getString("mincomp")+")";

                        fnewRow[6]=rs.getString("horastrab").substring(0,5);
                    }
                    else
                    {
                         fnewRow[5]="";
                        fnewRow[6]="";
                    }
                    fnewRow[7]=rs.getString("observaciones");
                    fnewRow[8]=rs.getString("idstatusconfirma")+":"+rs.getString("statusconfirmacion");
                    fnewRow[9]=rs.getString("id");
                    fnewRow[10]=rs.getString("despun");
                   jtable_modelo_asistenciaxdia_detalle.addRow(fnewRow);
                   //
                      this.jtf_horarioentro1.setText(rs.getString("hep").substring(0,5)+"("+rs.getString("horaentrada").substring(0,5)+")");
                            this.jtf_horariosalida1.setText(rs.getString("hsp").substring(0,5));
                            this.jtf_horarioentro2.setText(rs.getString("hecp").substring(0,5));
                            this.jtf_horariosalida2.setText(rs.getString("hsp").substring(0,5)+"("+rs.getString("horasalida").substring(0,5)+")");

                            if((rs.getString("horastrab")!=null)&&(!rs.getString("horasalida").substring(0, 5).equals("00:00")))
                                {
                                    tiempo=rs.getString("mincomida").split(":");
                                    minutos=(Integer.valueOf(tiempo[0])*60)+(Integer.valueOf(tiempo[1]));
                                    this.jtf_mincomida.setText(rs.getString("mincomp")+"/"+myFormat2.format(minutos));
                                }
                            else
                                {
                                     this.jtf_mincomida.setText(rs.getString("mincomp"));
                                }
                            switch (rs.getInt("idpuntual"))
                                    {
                                      case 0:
                                         this.jlbl_describepuntualidad.setForeground(Color.black);
                                       break;
                                        case 1:
                                             this.jlbl_describepuntualidad.setForeground(Color.green);
                                       break;
                                       case 2:
                                             this.jlbl_describepuntualidad.setForeground(Color.yellow);
                                      break;
                                        case 3:
                                         this.jlbl_describepuntualidad.setForeground(Color.red);
                                      break;
                            default:
                            break;
                            }
                             this.jlbl_describepuntualidad.setText("Asistencia:"+rs.getString("despun"));
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       

        if (encontro==0)
            {
                JOptionPane.showMessageDialog(null,"<html><h2>No Existen Registros Busqueda:"+busca1+"</h2></html>","Sistema Integral(Confirmar Asistencia) : Ayuda",1);
            }
     
      switch(indice)
            {
                case 0:
                            this.jlbl_resultado1.setText("Registros Encontrados:"+this.jtable_modelo_asistenciaxdia_detalle.getRowCount());
                            this.jpwd_codigorevision.setText("");
                            this.jpwd_codigorevision.requestFocus();
                break;
                case 2:
                            this.jlbl_resultado.setText("Registros Encontrados:"+this.jtable_modelo_asistenciaxdia_detalle.getRowCount());
                            this.jtf_busqueda.setText("");
                            this.jtf_busqueda.requestFocus();
                break;
            }

     if(this.jcbx_vertareasindi.isSelected()==true)
                        {
                            
                            this.carga_datos_tareaxdiaind(4, busca1, this.fechaamericana(this.jdc_fechaingreso.getDate()), "");
                        }
                     else
                        {
                             //this.crea_hoja_ventasxdia(titulografico.substring(2, 12),myFormatter.format(totalve),columtem+1);
                        }

      }
private int findcolumna_xma (String titulo)  {
  int columnas =jt_historialasistencia.getColumnModel().getColumnCount(),columencontrado=0;
  String columtitulo="";
      for(int j = 0 ;j < columnas ; j++)
                {
                    //columtitulo=jtable_modelo.getColumnName(j);
                    columtitulo=jt_historialasistencia.getColumnModel().getColumn(j).getHeaderValue().toString().substring(0, 10);
                     System.out.println(titulo+" "+columtitulo+" "+columencontrado);
                    if(columtitulo.equals(titulo))
                        {
                            columencontrado=j;

                        }
                }
    return columencontrado;
}
private void carga_datos_tareaxdia(int opcion,String idempleado,String fechaini,String fechafin)
    {
       String fechaeuro="",texto="select * from x1_supervision_empleados_tareas("+opcion+",'"+idempleado+"','"+fechaini+"','"+fechafin+"') as (id integer,fecha date,idempleado integer,idtar smallint,descrip text,iddep smallint);";
       int columnatitulo=0;
        System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,si_variables.getconexiongral());
            while (rs.next())
                {

                fechaeuro=this.fechaeuropea(rs.getString("fecha"));
                columnatitulo=this.findcolumna_xma(fechaeuro);
                //System.out.println("emplea "+rs.getString("idempleado")+" fecha:"+rs.getString("fecha")+" describe:"+rs.getString("descrip")+" Columna:"+columnatitulo+" fecha euro:"+ fechaeuro);
                this.crea_hoja_tareaprog(rs.getString("idempleado"), rs.getString("descrip"), columnatitulo);
                }
          }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }

     }
private void carga_datos_tareaxdiaind(int opcion,String idempleado,String fechaini,String fechafin)
    {
       String fechaeuro="",texto="select * from x1_supervision_empleados_tareas("+opcion+",'"+idempleado+"','"+fechaini+"','"+fechafin+"') as (id integer,fecha date,idempleado integer,idtar smallint,descrip text);",texto2="";
       int encontrado=0;
        System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,si_variables.getconexiongral());
            while (rs.next())
                {
                encontrado=1;
                texto2+="<BR>"+ rs.getString("descrip");

                }
          }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    if(encontrado==0)
        texto2="NO EXISTEN TAREAS DISPONIBLES";


        this.jep_tareas.setText("<html><body>"+texto2+"</body></html>");
     }
private void crea_hoja_tareaprog(String idempleado,String horaentrada,int columna)
    {
        int numerofilas=this.jtable_modelo_asistenciaxdia.getRowCount(),ii=00;
        String empleadoactual[]=null,texto="";
        //invoco al metodo que trae el recordset de datos

        for( ii=0;ii<numerofilas;ii++)
                {
                    empleadoactual=jtable_modelo_asistenciaxdia.getValueAt(ii, 1).toString().split(":");

                    if (empleadoactual[0].equals(idempleado))
                        {

                            texto=jtable_modelo_asistenciaxdia.getValueAt(ii, columna).toString().replace("<html>","").replace("</html>", "")+"";
                           System.out.println(empleadoactual[0]+" hora:"+horaentrada+" columna:"+columna+" empleado:"+idempleado+" texto:"+texto);
                             jtable_modelo_asistenciaxdia.setValueAt("<html>"+texto+" <br>"+horaentrada+" "+"</html>",ii ,columna);

                        }
                }

    }

private void carga_datos_empleado(int opcion,String textobusca)
   {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
       //this.LimpiarJTable();
    if (this.jckb_noeliminar.isSelected()==false)
        {
           while(this.jtable_modelo_asistenciaxdia.getRowCount()>0)this.jtable_modelo_asistenciaxdia.removeRow(0);
        }

       Object[] fnewRow = new Object[8];
       try
           {
            rs = x.sieuno_executediversosv2("select * from x1_supervision_empleadosv2("+opcion+",'"+textobusca+"') as (id integer,nombre text,id_depart smallint,fecha_alta text,descri_depa character varying(80));",si_variables.getconexiongral());
            while (rs.next())
                {
                        fnewRow[1]=rs.getString("id_depart")+":"+rs.getString("descri_depa");
                        fnewRow[3]=rs.getString("id")+":"+rs.getString("nombre");
                        this.crea_hojaasistenciama_sinchecar(rs.getString("id"), rs.getString("id_depart")+":"+rs.getString("descri_depa"),rs.getString("nombre"),"","","",2,"",0);
                }
           }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }
    }

private void crea_hojaasistenciama_sinchecar(String idempleado,String departamento,String nombre,String horaentrada,String horasalida,String stasis,int columna,String observacion,int idstatusasi)
    {
        int numerofilas=this.jtable_modelo_asistenciaxdia.getRowCount();
        String empleadoactual[]=null,texto="";
        int numerocolumnas=jt_historialasistencia.getColumnModel().getColumnCount(),ii=00;
        int encontrado=0;
        String abrehtml="",cierrahtml="";
        Object[] fnewRow = new Object[numerocolumnas];

       //invoco al metodo que trae el recordset de datos
        for( ii=0;ii<numerofilas;ii++)
                {
                    empleadoactual=jtable_modelo_asistenciaxdia.getValueAt(ii, 1).toString().split(":");
                     if (empleadoactual[0].equals(idempleado))
                        {
                            encontrado=1;
                        }
                }
       if(encontrado==0)
            {
                 fnewRow[0]=departamento;
                 fnewRow[1]=idempleado+":"+nombre;
                 for(ii=2;ii<numerocolumnas;ii++)
                            {
                     //System.out.println("ss"+ii+columna);
                               if(ii==columna)
                                    {
                                        fnewRow[ii]="";
                                    }
                               else
                                   {
                                        fnewRow[ii]="";
                                   }
                            }
             jtable_modelo_asistenciaxdia.addRow(fnewRow);
            }
    }


private void imprimir_checcom(String folio)
    {
    /* this.objimpresora=new com_distri_folios_imprimir();
     this.objimpresora.setOneItem_cadenas_a_imprimir(".");
     this.objimpresora.setOneItem_cadenas_a_imprimir("      Folio:"+folio);
     this.objimpresora.setOneItem_cadenas_a_imprimir("      Fecha Asist."+this.jtf_fechachequeo.getText());
     this.objimpresora.setOneItem_cadenas_a_imprimir("      Hora E. Prog / Real:"+this.jtf_horarioentro1.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("      Hora Sal. Prog / Real :"+this.jtf_horariosalida2.getText()+"");
     this.objimpresora.setOneItem_cadenas_a_imprimir("     Minutos de Comida Prog / Real: "+this.jtf_mincomida.getText());
     this.objimpresora.setOneItem_cadenas_a_imprimir("..  ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..  ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..  ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("..  ");
     this.objimpresora.setOneItem_cadenas_a_imprimir("*");
     this.objimpresora.setObjeto_tabla(jt_historialasistencia_detalle1);
     this.objimpresora.imprimir_all(14,1);
     */
    }

private String DiaSemana(String fe) {
         String dia = "";
       java.util.Date fecha=null;
         try
            {
             fecha = formateadoresta.parse(fe);

           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }
private void dioclicktar(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
        this.jtf_tiendaactual.setText(this.jlst_clientesdistribucion.getSelectedValue().toString());

    }

  private void proceso_local_datos(String refnombre){
    supervision_rh_asistencia_checador_xmlguarda xml = null;
        try
        {
            File archivo = new File(this.jtf_unidadlocal.getText().toUpperCase().replace(":", "")+":/sichecadoslocal.xml");
            if (archivo.exists())
                {
                    SAXBuilder cons=new SAXBuilder();
                    Document doc = cons.build(archivo);
                    Element xmlRaiz=doc.getRootElement();
                    java.util.List checados =xmlRaiz.getChildren("chequeo");
                    Iterator iter =checados.iterator();
                    while(iter.hasNext())
                        {
                            Element checado=(Element) iter.next();
                            Element eidcodigo=checado.getChild("idcodigo");
                            Element efecha=checado.getChild("fecha");
                            Element ehora=checado.getChild("hora");
                            Element eobservacion=checado.getChild("observacion");
                            Element enombre=checado.getChild("nombre");
                            xml=new supervision_rh_asistencia_checador_xmlguarda(eidcodigo.getText(),efecha.getText(),ehora.getText(),eobservacion.getText(),enombre.getText());
                            this.datosxmlcrea(xml,1);
                        }
                }
            //archivo.delete();
        }
        catch (Exception ex)
            {
                JOptionPane.showMessageDialog(null,"Error, Verifique unidad Local de Disco(C:) O Comuniquese con su Administrador","Sistema Integral(Chequeo Asistencia) : Ayuda",1);
                ex.printStackTrace();
            }
        java.util.Date fechaactualiza=new Date();
        xml=new supervision_rh_asistencia_checador_xmlguarda(this.jpsw_codigo.getText(),this.fechaamericana(fechaactualiza),fechaactualiza.getHours()+":"+fechaactualiza.getMinutes()+":"+fechaactualiza.getSeconds(),this.jtf_observacion.getText(),refnombre);
        this.datosxmlcrea(xml,2);
}

    private void creachequeo(String codigo,String observa)
    {
    DecimalFormat myFormat2 = new DecimalFormat("############");
    int folio=0,minutos=0;
    String texto="select * from x1_supervision_empleados_asistencia_insert('"+codigo.trim()+"','"+observa+"');",tiempo[]=null;
    this.jep_tareas.setText("");
     System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,si_variables.getconexiongral());
            while (rs.next())
                {
                       folio=rs.getInt(1);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
        if (folio>0)
            {
            switch (folio)
                {
                    case 1:
                          JOptionPane.showMessageDialog(null," Codigo no Existe","Sistema Integral(Chequeo Asistencia) : Ayuda",1);
                          this.jpsw_codigo.setText("");
                          this.jpsw_codigo.requestFocus();
                    break;
                    case 2:
                            JOptionPane.showMessageDialog(null,"Registro Ingreso Correcto","Sistema Integral(Chequeo Asistencia) : Ayuda",1);
                            this.jtf_observacion.setText("");
                            this.jpsw_codigo.setText("");
                            this.jpsw_codigo.requestFocus();

                                try
                                    {
                                     rs = x.sieuno_executediversosv2("select to_char(timestamp 'now','HH12:MI:SS');",si_variables.getconexiongral());
                                    while (rs.next())
                                        {
                                           this.jtf_horaregistro.setText(rs.getString(1));
                                        }
                                    }
                                    catch(Exception e)
                                        {
                                            System.out.println(e.getMessage());
                                        }

                                try
                                    {
                                    rs = x.sieuno_executediversosv2("select * from x1_supervision_empleados_asistencia_ultimaentrada('"+codigo.trim()+"') as (id integer,nombre character varying(50),nomapat character varying(50),horaentrada time);",si_variables.getconexiongral());
                                    while (rs.next())
                                        {
                                           this.jtf_nombrecolaborador.setText(rs.getString("nombre")+" "+rs.getString("nomapat"));
                                           this.jtf_nombrecolaboradorprogramado.setText(rs.getString("nombre")+" "+rs.getString("nomapat"));
                                           this.jtf_horarioentro.setText(rs.getString("horaentrada").substring(0, 5));
                                           this.jtf_horariosalida.setText("");

                                           this.jep_fotoempleado.setText("<html><head></head><body><p style=\"margin-top: 0\"><img src=\"http://michelleptv.dyndns.org/javaweb/rhfotos/"+rs.getString("id")+".JPG"+"\" width=\"140\" height=\"120\" border=\"0\" alt=\"Foto\"></img></p></body></html>");
                                        }
                                    }
                                    catch(Exception e)
                                        {
                                            System.out.println(e.getMessage());
                                        }
                       System.out.println("si incontro avisos");
                              try
                                    {
                                     rs = x.sieuno_executediversosv2("select * from x1_supervision_empleados_avisos('"+codigo.trim()+"') as (fechaaviso date,describe text);",si_variables.getconexiongral());
                                    while (rs.next())
                                        {
                                            System.out.println("si incontro avisos");
                                           this.jLabel5.setText("<html>"+"Avisos:"+rs.getString("describe")+"<br>!GRACIAS!</html>");
                                        }
                                    }
                                    catch(Exception e)
                                        {
                                            System.out.println(e.getMessage());
                                        }

                    break;
                    case 3:
                            JOptionPane.showMessageDialog(null,"Registro Salida Correcta","Sistema Integral(Chequeo Asistencia) : Ayuda",1);
                            this.jtf_observacion.setText("");
                            this.jpsw_codigo.setText("");
                            this.jpsw_codigo.requestFocus();

                                try
                                    {
                                    rs = x.sieuno_executediversosv2("select to_char(timestamp 'now','HH12:MI:SS');",si_variables.getconexiongral());
                                    while (rs.next())
                                        {
                                           this.jtf_horaregistro.setText(rs.getString(1));
                                        }
                                    }
                                    catch(Exception e)
                                        {
                                            System.out.println(e.getMessage());
                                        }


                                try
                                    {
                                    rs = x.sieuno_executediversosv2("select * from x1_supervision_empleados_asistencia_ultimasalida('"+codigo.trim()+"') as (id integer,nombre character varying(50),nomapat character varying(50),horasalida time);",si_variables.getconexiongral());
                                    while (rs.next())
                                        {

                                           this.jtf_nombrecolaborador.setText(rs.getString("nombre")+" "+rs.getString("nomapat"));
                                           this.jtf_horariosalida.setText(rs.getString("horasalida").substring(0, 5));
                                           this.jtf_horarioentro.setText("");
                                            this.jep_fotoempleado.setText("<html><head></head><body><p style=\"margin-top: 0\"><img src=\"http://michelleptv.dyndns.org/javaweb/rhfotos/"+rs.getString("id")+".JPG"+"\" width=\"280\" height=\"240\" border=\"0\" alt=\"Foto\"></img></p></body></html>");
                                        }
                                    }
                                    catch(Exception e)
                                        {
                                            System.out.println(e.getMessage());
                                        }
                                System.out.println("si incontro avisos");
                                try
                                    {
                                     rs = x.sieuno_executediversosv2("select * from x1_supervision_empleados_avisos('"+codigo.trim()+"') as (fechaaviso date,describe text);",si_variables.getconexiongral());
                                    while (rs.next())
                                        {
                                           System.out.println("si incontro avisos");
                                            this.jLabel5.setText("<html>"+"Avisos:"+rs.getString("describe")+"<br>!GRACIAS!</html>");
                                        }
                                    }
                                    catch(Exception e)
                                        {
                                            System.out.println(e.getMessage());
                                        }
                    break;
                }
            //voy a ver cual era su hora programada para ese dia
            texto="select * from x1_supervision_empleados_asistencia_catalogo(14,'"+codigo.trim()+"','"+this.fechaamericana(this.jdc_fechaingreso.getDate())+"','"+""+"') as (id integer,fechaasiste date,idempleado integer,horaentrada time,horasalida time,idstatus smallint,observaciones text,iddepartamento smallint,idstatusconfirma smallint,nombreempleado character varying(50),nombrepat character varying(50),nombremat character varying(50),statusdescribe text,describedepa character varying(80),statusconfirmacion text,horastrab interval,mincomida interval,idpuntual smallint,despun text,hep time,hsp time,hecp time,hscp time,mincomp smallint);";
            System.out.println(texto);
            try
                {
                 rs = x.sieuno_executediversosv2(texto,si_variables.getconexiongral());
                    while (rs.next())
                        {
                            this.jtf_id.setText(rs.getString("id"));
                            this.jtf_horarioentro1.setText(rs.getString("hep").substring(0,5)+"("+rs.getString("horaentrada").substring(0,5)+")");
                            this.jtf_horariosalida1.setText(rs.getString("hsp").substring(0,5));
                            this.jtf_horarioentro2.setText(rs.getString("hecp").substring(0,5));
                            this.jtf_horariosalida2.setText(rs.getString("hsp").substring(0,5)+"("+rs.getString("horasalida").substring(0,5)+")");

                            if((rs.getString("horastrab")!=null)&&(!rs.getString("horasalida").substring(0, 5).equals("00:00")))
                                {
                                    tiempo=rs.getString("mincomida").split(":");
                                    minutos=(Integer.valueOf(tiempo[0])*60)+(Integer.valueOf(tiempo[1]));
                                    this.jtf_mincomida.setText(rs.getString("mincomp")+"/"+myFormat2.format(minutos));
                                }
                            else
                                {
                                     this.jtf_mincomida.setText(rs.getString("mincomp"));
                                }
                            switch (rs.getInt("idpuntual"))
                                    {
                                      case 0:
                                         this.jlbl_describepuntualidad.setForeground(Color.black);
                                       break;
                                        case 1:
                                             this.jlbl_describepuntualidad.setForeground(Color.green);
                                       break;
                                       case 2:
                                             this.jlbl_describepuntualidad.setForeground(Color.yellow);
                                      break;
                                        case 3:
                                         this.jlbl_describepuntualidad.setForeground(Color.orange);
                                      break;
                            default:
                            break;
                        }
                             this.jlbl_describepuntualidad.setText("Asistencia:"+rs.getString("despun"));
                        }
                    }
                    catch(Exception e)
                        {
                            System.out.println(e.getMessage());
                        }

              if(this.jcbx_vertareasindi.isSelected()==true)
                        {

                            this.carga_datos_tareaxdiaind(4, codigo, this.fechaamericana(this.jdc_fechaingreso.getDate()), "");
                        }
                     else
                        {
                             //this.crea_hoja_ventasxdia(titulografico.substring(2, 12),myFormatter.format(totalve),columtem+1);
                        }
        }
        else
        {
           if(JOptionPane.showConfirmDialog(null, "Error! Servidor No responde,Desea Guardar su Registro de Forma Local?")==0)
                {
                    String ingresanombre=JOptionPane.showInputDialog("Ingrese su Nombre como Referencia:");
                    this.proceso_local_datos(ingresanombre);
                }
        }
     }
    public void datosxmlcrea(supervision_rh_asistencia_checador_xmlguarda checar,int opcion){
Document nuevoDoc = null;
     switch (opcion)
        {
            case 1:
                xmlRaiz.addContent(checar);
            break;
            case 2:
                xmlRaiz.addContent(checar);
                nuevoDoc = new Document(xmlRaiz);
                this.datosxmlguarda(nuevoDoc);
                xmlRaiz =new Element("checados");
            break;
            case 3:
                nuevoDoc = new Document(xmlRaiz);
                this.datosxmlguarda(nuevoDoc);
                xmlRaiz =new Element("checados");
            break;
        }
}
    public void datosxmlguarda(Document doc){
     FileOutputStream file=null;
     int error=-1;
     XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
     File nuevoXML = new File(this.jtf_unidadlocal.getText().toUpperCase().replace(":", "")+":\\sichecadoslocal.xml");
        try {
             file = new FileOutputStream(nuevoXML);
            try{
                out.output(doc, file);
                out.output(doc, System.out);
                sihayregistros=1;
            } catch (IOException ex) {
                Logger.getLogger(supervision_rh_asistencia_checador.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (FileNotFoundException ex) {
            Logger.getLogger(supervision_rh_asistencia_checador.class.getName()).log(Level.SEVERE, null, ex);
            JOptionPane.showMessageDialog(null,"Error, Verifique unidad Local de Disco(C:) O Comuniquese con su Administrador!","Sistema Integral(Chequeo Asistencia) : Ayuda",1);
        }

        try {
            file.close();
            error=0;
        } catch (IOException ex) {
            Logger.getLogger(supervision_rh_asistencia_checador.class.getName()).log(Level.SEVERE, null, ex);
        }
      if(error==0)
            {
                JOptionPane.showMessageDialog(null,"Gracias Registro Local Correcto","Sistema Integral(Chequeo Asistencia) : Ayuda",1);
            }
        xmlRaiz=null;
 }

    private void avisos_add(String empleado,String comentario,String fechaaviso){
        String texto="",confirma="";
        texto="select * from x1_supervision_empleados_avisos_insert('"+fechaaviso+"','"+empleado+"','"+comentario+"');";
        System.out.println(texto);

            try
            {
                rs = x.sieuno_executediversosv2(texto,si_variables.getconexiongral());

               while (rs.next())
                    {
                      confirma=rs.getString(1);
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
         if (confirma.equals("1"))
              {
                   JOptionPane.showMessageDialog(null,"Aviso Informe a su Admon."+comentario+" No Encontrado", "Sistema Integral Tareas",1);
              }



    }

             private String  fechaeuropea(Date fecha) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";

       cadenafecha= formateadorestaeuropa.format(fecha);
       return cadenafecha;

    }

 private String  fechaamericana(String fecha) {

         //resibe cadena de fecha en formato americano dd-MM-yyyy
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaamericano = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateador.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaamericano.format(fechaestaeuropa);
       return cadenafecha;

    }

    private String fechaamericana(Date fe) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;

    }
    private String  fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jep_fotoempleado = new javax.swing.JEditorPane();
        jPanel3 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jtf_horarioentro = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jtf_horariosalida = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jtf_nombrecolaborador = new javax.swing.JTextField();
        jtf_fechachequeo = new javax.swing.JTextField();
        jtf_id = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jtf_unidadlocal = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jtf_horaregistro = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jpsw_codigo = new javax.swing.JPasswordField();
        jLabel1 = new javax.swing.JLabel();
        jtf_observacion = new javax.swing.JTextField();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane12 = new javax.swing.JScrollPane();
        jt_historialasistencia_detalle1 = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jLabel16 = new javax.swing.JLabel();
        jbtn_buscarasistenciacodigo = new javax.swing.JButton();
        jlbl_resultado1 = new javax.swing.JLabel();
        jpwd_codigorevision = new javax.swing.JPasswordField();
        jbtn_imprimir = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jtf_horarioentro1 = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jtf_horariosalida1 = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jtf_nombrecolaboradorprogramado = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jtf_horarioentro2 = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jtf_horariosalida2 = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jtf_mincomida = new javax.swing.JTextField();
        jlbl_describepuntualidad = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jep_tareas = new javax.swing.JEditorPane();
        jcbx_vertareasindi = new javax.swing.JCheckBox();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jtbl_detalleapartado = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }}
            ;
            jButton1 = new javax.swing.JButton();
            jLabel8 = new javax.swing.JLabel();
            jLabel9 = new javax.swing.JLabel();
            jLabel10 = new javax.swing.JLabel();
            jLabel11 = new javax.swing.JLabel();
            jLabel12 = new javax.swing.JLabel();
            jbtn_verdatoslocales = new javax.swing.JButton();
            jPanel6 = new javax.swing.JPanel();
            jPanel7 = new javax.swing.JPanel();
            jScrollPane11 = new javax.swing.JScrollPane();
            jt_historialasistencia_detalle = new javax.swing.JTable()
            {
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    return false;
                }
            }
            ;
            jLabel14 = new javax.swing.JLabel();
            jtf_busqueda = new javax.swing.JTextField();
            jbtn_buscarasistencia = new javax.swing.JButton();
            jdc_fechaingreso = new com.toedter.calendar.JDateChooser();
            jLabel15 = new javax.swing.JLabel();
            jlbl_resultado = new javax.swing.JLabel();
            jPanel12 = new javax.swing.JPanel();
            jPanel13 = new javax.swing.JPanel();
            jLabel23 = new javax.swing.JLabel();
            jdc_fechainicial = new com.toedter.calendar.JDateChooser();
            jLabel24 = new javax.swing.JLabel();
            jdc_fechafinal = new com.toedter.calendar.JDateChooser();
            jbtn_generareporte = new javax.swing.JButton();
            jrbtn_estasemana = new javax.swing.JRadioButton();
            jrbtn_semanaproxima = new javax.swing.JRadioButton();
            jScrollPane6 = new javax.swing.JScrollPane();
            jlst_clientesdistribucion = new javax.swing.JList();
            jtf_tiendaactual = new javax.swing.JTextField();
            jckb_noeliminar = new javax.swing.JCheckBox();
            jPanel14 = new javax.swing.JPanel();
            jScrollPane10 = new javax.swing.JScrollPane();
            jt_historialasistencia = new javax.swing.JTable()
            {
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    return false;
                }
            }
            ;
            jMenuBar1 = new javax.swing.JMenuBar();
            jMenu1 = new javax.swing.JMenu();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenu2 = new javax.swing.JMenu();

            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

            jTabbedPane1.addChangeListener(new javax.swing.event.ChangeListener() {
                public void stateChanged(javax.swing.event.ChangeEvent evt) {
                    jTabbedPane1StateChanged(evt);
                }
            });

            jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Web Cam"));

            jScrollPane1.setViewportView(jEditorPane1);

            javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
            jPanel2.setLayout(jPanel2Layout);
            jPanel2Layout.setHorizontalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE)
                    .addContainerGap())
            );
            jPanel2Layout.setVerticalGroup(
                jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
            );

            jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Foto Colaborador"));

            jep_fotoempleado.setContentType("text/html");
            jScrollPane3.setViewportView(jep_fotoempleado);

            javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
            jPanel4.setLayout(jPanel4Layout);
            jPanel4Layout.setHorizontalGroup(
                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
            );
            jPanel4Layout.setVerticalGroup(
                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
            );

            jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Ultmo Chec"));

            jLabel3.setText("Horario Entrada:");

            jtf_horarioentro.setEditable(false);
            jtf_horarioentro.setFont(new java.awt.Font("Tahoma", 0, 18));

            jLabel4.setText("Horario Salida");

            jtf_horariosalida.setEditable(false);
            jtf_horariosalida.setFont(new java.awt.Font("Tahoma", 0, 18));

            jLabel6.setText("Colaborador:");

            jtf_nombrecolaborador.setEditable(false);
            jtf_nombrecolaborador.setFont(new java.awt.Font("Tahoma", 0, 18));

            jtf_fechachequeo.setEditable(false);
            jtf_fechachequeo.setFont(new java.awt.Font("Times New Roman 14", 1, 12));

            jtf_id.setEditable(false);
            jtf_id.setFont(new java.awt.Font("Times New Roman 14 12", 1, 12));

            javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
            jPanel3.setLayout(jPanel3Layout);
            jPanel3Layout.setHorizontalGroup(
                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addComponent(jLabel6)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jtf_nombrecolaborador, javax.swing.GroupLayout.PREFERRED_SIZE, 323, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_fechachequeo, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addComponent(jLabel3)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_horarioentro, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel4)
                            .addGap(18, 18, 18)
                            .addComponent(jtf_horariosalida, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jtf_id, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)))
                    .addContainerGap())
            );
            jPanel3Layout.setVerticalGroup(
                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel6)
                        .addComponent(jtf_nombrecolaborador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jtf_horarioentro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4)
                        .addComponent(jtf_horariosalida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtf_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addComponent(jtf_fechachequeo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            );

            jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Agregar Asistencia"));

            jLabel5.setFont(new java.awt.Font("Tahoma", 1, 24));
            jLabel5.setForeground(new java.awt.Color(153, 0, 0));
            jLabel5.setText("Avisos:");

            jtf_unidadlocal.setEditable(false);
            jtf_unidadlocal.setText("C");
            jtf_unidadlocal.setToolTipText("Ingrese Unidad de Disco ejemplo C, D,E,F,G,H ETC.");
            jtf_unidadlocal.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_unidadlocalActionPerformed(evt);
                }
            });

            jLabel13.setText("Unidad Local:");

            jLabel7.setText("Hora Registro:");

            jtf_horaregistro.setEditable(false);
            jtf_horaregistro.setFont(new java.awt.Font("Tahoma", 0, 18));

            jLabel2.setText("Codigo:");

            jpsw_codigo.setToolTipText("Ingrese Codigo de Identificacion");
            jpsw_codigo.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jpsw_codigoActionPerformed(evt);
                }
            });

            jLabel1.setText("Anotaciones de Chequeo:");

            jtf_observacion.setToolTipText("Ingresa alguna anotacion antes de Checarse");
            jtf_observacion.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtf_observacionActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
            jPanel8.setLayout(jPanel8Layout);
            jPanel8Layout.setHorizontalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_observacion, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGap(128, 128, 128)
                            .addComponent(jtf_unidadlocal, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jLabel13)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel8Layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addGap(58, 58, 58)
                                .addComponent(jtf_horaregistro))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel8Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addGap(91, 91, 91)
                                .addComponent(jpsw_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addComponent(jLabel5))
                    .addContainerGap(55, Short.MAX_VALUE))
            );
            jPanel8Layout.setVerticalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(jtf_observacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(jpsw_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel7)
                        .addComponent(jtf_horaregistro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGap(3, 3, 3)
                            .addComponent(jLabel13))
                        .addComponent(jtf_unidadlocal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel5)
                    .addContainerGap(37, Short.MAX_VALUE))
            );

            jt_historialasistencia_detalle1.setFont(new java.awt.Font("Comic Sans MS 13", 0, 12));
            jt_historialasistencia_detalle1.setModel(this.jtable_modelo_asistenciaxdia_detalle);
            jt_historialasistencia_detalle1.setRowHeight(18);
            jScrollPane12.setViewportView(jt_historialasistencia_detalle1);

            jLabel16.setText("Ingrese Codigo:");

            jbtn_buscarasistenciacodigo.setText("<html> <U><b>B</b></u>uscar </html>");
            jbtn_buscarasistenciacodigo.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_buscarasistenciacodigoActionPerformed(evt);
                }
            });

            jlbl_resultado1.setText("Resultados de Busquda:");

            jpwd_codigorevision.setToolTipText("Ingrese su Codigo para revisar sus Chequeos el DIa de Hoy");
            jpwd_codigorevision.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jpwd_codigorevisionActionPerformed(evt);
                }
            });

            jbtn_imprimir.setText("Imprimir");
            jbtn_imprimir.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_imprimirActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
            jPanel9.setLayout(jPanel9Layout);
            jPanel9Layout.setHorizontalGroup(
                jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addComponent(jLabel16)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jpwd_codigorevision, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(46, 46, 46)
                    .addComponent(jbtn_buscarasistenciacodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jlbl_resultado1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 355, Short.MAX_VALUE)
                    .addComponent(jbtn_imprimir)
                    .addGap(60, 60, 60))
                .addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 905, Short.MAX_VALUE)
            );
            jPanel9Layout.setVerticalGroup(
                jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel9Layout.createSequentialGroup()
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel16)
                                .addComponent(jbtn_buscarasistenciacodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jpwd_codigorevision, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jlbl_resultado1))
                        .addComponent(jbtn_imprimir))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE))
            );

            jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Horarios Programados y Reales"));

            jLabel17.setText("H. Ent.Prog/Real");

            jtf_horarioentro1.setEditable(false);
            jtf_horarioentro1.setFont(new java.awt.Font("Times New Roman", 1, 14));

            jLabel18.setText("Horario Salida");

            jtf_horariosalida1.setEditable(false);
            jtf_horariosalida1.setFont(new java.awt.Font("Times New Roman", 1, 14));

            jLabel19.setText("Colaborador:");

            jtf_nombrecolaboradorprogramado.setEditable(false);
            jtf_nombrecolaboradorprogramado.setFont(new java.awt.Font("Tahoma 18", 0, 12));

            jLabel20.setText("Horario Entrada:");

            jtf_horarioentro2.setEditable(false);
            jtf_horarioentro2.setFont(new java.awt.Font("Times New Roman", 1, 14));

            jLabel21.setText("H. Sal./Real");

            jtf_horariosalida2.setEditable(false);
            jtf_horariosalida2.setFont(new java.awt.Font("Times New Roman", 1, 14));

            jLabel22.setFont(new java.awt.Font("Tahoma", 1, 12));
            jLabel22.setText("Min Comida Pro/Real");

            jtf_mincomida.setEditable(false);
            jtf_mincomida.setFont(new java.awt.Font("Times New Roman 12", 1, 14));
            jtf_mincomida.setToolTipText("Minutos d Comida programados y Real");

            jlbl_describepuntualidad.setFont(new java.awt.Font("Tahoma 12", 1, 12));
            jlbl_describepuntualidad.setText("Asistencia:");

            javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
            jPanel10.setLayout(jPanel10Layout);
            jPanel10Layout.setHorizontalGroup(
                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addComponent(jLabel19)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jtf_nombrecolaboradorprogramado, javax.swing.GroupLayout.PREFERRED_SIZE, 239, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jlbl_describepuntualidad, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE))
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addComponent(jLabel17)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_horarioentro1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel18)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_horariosalida1, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(32, 32, 32)
                            .addComponent(jLabel22))
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addComponent(jLabel20)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jtf_horarioentro2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLabel21)
                            .addGap(18, 18, 18)
                            .addComponent(jtf_horariosalida2, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jtf_mincomida, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)))
                    .addContainerGap())
            );
            jPanel10Layout.setVerticalGroup(
                jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel19)
                        .addComponent(jtf_nombrecolaboradorprogramado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jlbl_describepuntualidad, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel17)
                        .addComponent(jtf_horarioentro1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel18)
                        .addComponent(jLabel22)
                        .addComponent(jtf_horariosalida1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel20)
                            .addComponent(jtf_horarioentro2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel21)
                            .addComponent(jtf_horariosalida2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                            .addComponent(jtf_mincomida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11))))
            );

            jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Tareas"));

            jep_tareas.setContentType("text/html");
            jScrollPane4.setViewportView(jep_tareas);

            jcbx_vertareasindi.setSelected(true);
            jcbx_vertareasindi.setText("Ver Tareas");

            javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
            jPanel11.setLayout(jPanel11Layout);
            jPanel11Layout.setHorizontalGroup(
                jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel11Layout.createSequentialGroup()
                    .addComponent(jcbx_vertareasindi)
                    .addContainerGap())
                .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
            );
            jPanel11Layout.setVerticalGroup(
                jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel11Layout.createSequentialGroup()
                    .addComponent(jcbx_vertareasindi)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE))
            );

            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
                    .addContainerGap())
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(19, 19, 19)
                            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(23, 23, 23))
            );

            jTabbedPane1.addTab("Checador", jPanel1);

            jtbl_detalleapartado.setModel(this.jtable_modelo_checlocal);
            jScrollPane2.setViewportView(jtbl_detalleapartado);

            jButton1.setText("Subir Datos al Servidor");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });

            jLabel8.setText("Nota1: Esta opcion se Activa cuando por alguna razon no existe conexion con el servidor, al pasar codigo intentara conectarse por lo que puede");

            jLabel9.setText("tardar unos segundos en hacer su registro, por favor sea paciente, Por otra parte si su codigo es mal tecleado este no enviara mensaje");

            jLabel10.setText("indicando su error, pero a la hora de subir los datos al servidor sera enviado a una bitacora donde su administrador corregira el error, de ahi");

            jLabel11.setText("la importancia que indique su nombre para referencia. La actualizacion se hara en el momento que se intenten checar o bien si preciona");

            jLabel12.setText("el boton para actualizar los datos al servidor. Gracias");

            jbtn_verdatoslocales.setText("Ver Datos Locales");
            jbtn_verdatoslocales.setToolTipText("carga datos Guardados localmente, especifique unidad de forma correcta default es C:");
            jbtn_verdatoslocales.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_verdatoslocalesActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
            jPanel5.setLayout(jPanel5Layout);
            jPanel5Layout.setHorizontalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 895, Short.MAX_VALUE)
                                .addGroup(jPanel5Layout.createSequentialGroup()
                                    .addComponent(jButton1)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jbtn_verdatoslocales))))
                        .addGroup(jPanel5Layout.createSequentialGroup()
                            .addGap(29, 29, 29)
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel9)
                                .addComponent(jLabel8)
                                .addComponent(jLabel10)
                                .addComponent(jLabel11)
                                .addComponent(jLabel12))))
                    .addContainerGap())
            );
            jPanel5Layout.setVerticalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addGap(39, 39, 39)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
                    .addGap(18, 18, 18)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton1)
                        .addComponent(jbtn_verdatoslocales))
                    .addGap(53, 53, 53)
                    .addComponent(jLabel8)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel9)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel10)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel11)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel12)
                    .addGap(182, 182, 182))
            );

            jTabbedPane1.addTab("Registros Sin Conexion", jPanel5);

            jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Revision de Asistencia x Colaborador"));

            jt_historialasistencia_detalle.setFont(new java.awt.Font("Comic Sans MS", 0, 13));
            jt_historialasistencia_detalle.setModel(this.jtable_modelo_asistenciaxdia_detalle);
            jt_historialasistencia_detalle.setRowHeight(18);
            jScrollPane11.setViewportView(jt_historialasistencia_detalle);

            jLabel14.setText("Ingrese Texto:");

            jbtn_buscarasistencia.setText("<html> <U><b>B</b></u>uscar </html>");
            jbtn_buscarasistencia.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_buscarasistenciaActionPerformed(evt);
                }
            });

            jdc_fechaingreso.setToolTipText("Asegurese de Ingresar fechas con -, LA / NO ESTA HABILITADA, SI LA FECHA ESTA EN ROJO, ESTA NO EXISTE");
            jdc_fechaingreso.setDateFormatString("d-MM-yyyy");
            jdc_fechaingreso.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    jdc_fechaingresoKeyPressed(evt);
                }
            });

            jLabel15.setText("Fecha:");

            jlbl_resultado.setText("Resultados de Busquda:");

            javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
            jPanel7.setLayout(jPanel7Layout);
            jPanel7Layout.setHorizontalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel15)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jdc_fechaingreso, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jLabel14)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jbtn_buscarasistencia, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jlbl_resultado)
                    .addContainerGap(313, Short.MAX_VALUE))
                .addComponent(jScrollPane11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 903, Short.MAX_VALUE)
            );
            jPanel7Layout.setVerticalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel15)
                        .addComponent(jdc_fechaingreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jbtn_buscarasistencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14)
                            .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jlbl_resultado)))
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE))
            );

            javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
            jPanel6.setLayout(jPanel6Layout);
            jPanel6Layout.setHorizontalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            jPanel6Layout.setVerticalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addGap(24, 24, 24)
                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(394, Short.MAX_VALUE))
            );

            jTabbedPane1.addTab("Revision de Estado de Asistencia", jPanel6);

            jLabel23.setText("<html><b>F. Inicial:</b></html>");

            jdc_fechainicial.setToolTipText("Asegurese de Ingresar fechas con -, LA / NO ESTA HABILITADA, SI LA FECHA ESTA EN ROJO, ESTA NO EXISTE");
            jdc_fechainicial.setDateFormatString("d-MM-yyyy");

            jLabel24.setText("<html><b>F. Final:</b></html>");

            jdc_fechafinal.setToolTipText("Asegurese de Ingresar fechas con -, LA / NO ESTA HABILITADA, SI LA FECHA ESTA EN ROJO, ESTA NO EXISTE");
            jdc_fechafinal.setDateFormatString("d-MM-yyyy");
            jdc_fechafinal.setMaxSelectableDate(new java.util.Date(253370790102000L));

            jbtn_generareporte.setText("Ver Tareas");
            jbtn_generareporte.setToolTipText("Precione este Boton una vez especificadas las fechas,Muestra ventas x dia, Los totales NO Restan los Pagos con Monedero");
            jbtn_generareporte.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jbtn_generareporteActionPerformed(evt);
                }
            });

            jrbtn_estasemana.setText("Esta Semana");
            jrbtn_estasemana.setToolTipText("establece Fecha Inicial y Fecha final de Esta semana Primer dia Lunes");
            jrbtn_estasemana.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jrbtn_estasemanaActionPerformed(evt);
                }
            });

            jrbtn_semanaproxima.setText("Semana Proxima");
            jrbtn_semanaproxima.setToolTipText("establece Fecha Inicial y Fecha final de semana pasada Primer dia Lunes");
            jrbtn_semanaproxima.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jrbtn_semanaproximaActionPerformed(evt);
                }
            });

            jlst_clientesdistribucion.setModel(this.modelo);
            jlst_clientesdistribucion.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
            jlst_clientesdistribucion.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jlst_clientesdistribucionMouseClicked(evt);
                    if(evt.getClickCount() >= 1)
                    {
                        dioclicktar(evt);
                    }
                }
            });
            jScrollPane6.setViewportView(jlst_clientesdistribucion);

            jtf_tiendaactual.setEditable(false);

            jckb_noeliminar.setText("No eliminar Historial");
            jckb_noeliminar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jckb_noeliminarActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
            jPanel13.setLayout(jPanel13Layout);
            jPanel13Layout.setHorizontalGroup(
                jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup()
                    .addGap(36, 36, 36)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel13Layout.createSequentialGroup()
                            .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout.createSequentialGroup()
                                    .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jdc_fechainicial, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jdc_fechafinal, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel13Layout.createSequentialGroup()
                                    .addComponent(jrbtn_estasemana)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jrbtn_semanaproxima)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout.createSequentialGroup()
                                    .addComponent(jtf_tiendaactual, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                                    .addGap(194, 194, 194))
                                .addGroup(jPanel13Layout.createSequentialGroup()
                                    .addComponent(jckb_noeliminar)
                                    .addContainerGap())))
                        .addComponent(jbtn_generareporte, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)))
            );
            jPanel13Layout.setVerticalGroup(
                jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel13Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel13Layout.createSequentialGroup()
                            .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel13Layout.createSequentialGroup()
                                    .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jdc_fechainicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jdc_fechafinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGap(3, 3, 3))
                                .addComponent(jckb_noeliminar))
                            .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel13Layout.createSequentialGroup()
                                    .addGap(3, 3, 3)
                                    .addComponent(jtf_tiendaactual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel13Layout.createSequentialGroup()
                                    .addGap(18, 18, 18)
                                    .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jrbtn_estasemana, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jrbtn_semanaproxima, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGap(7, 7, 7)
                            .addComponent(jbtn_generareporte)
                            .addContainerGap(36, Short.MAX_VALUE))
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 122, Short.MAX_VALUE)))
            );

            jt_historialasistencia.setModel(this.jtable_modelo_asistenciaxdia);
            jt_historialasistencia.setRowHeight(100);
            jScrollPane10.setViewportView(jt_historialasistencia);

            javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
            jPanel14.setLayout(jPanel14Layout);
            jPanel14Layout.setHorizontalGroup(
                jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 915, Short.MAX_VALUE)
            );
            jPanel14Layout.setVerticalGroup(
                jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup()
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 442, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );

            javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
            jPanel12.setLayout(jPanel12Layout);
            jPanel12Layout.setHorizontalGroup(
                jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            jPanel12Layout.setVerticalGroup(
                jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel12Layout.createSequentialGroup()
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap())
            );

            jTabbedPane1.addTab("Rol de Tareas", jPanel12);

            jMenu1.setText("Archivo");

            jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/door_out.png"))); // NOI18N
            jMenuItem1.setText("<html> <U><b>S</b></U>alir</html>");
            jMenu1.add(jMenuItem1);

            jMenuBar1.add(jMenu1);

            jMenu2.setText("Edicion");
            jMenuBar1.add(jMenu2);

            setJMenuBar(jMenuBar1);

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 920, Short.MAX_VALUE)
                    .addContainerGap())
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 629, javax.swing.GroupLayout.PREFERRED_SIZE)
            );

            pack();
        }// </editor-fold>//GEN-END:initComponents

    private void jtf_unidadlocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_unidadlocalActionPerformed
        // TODO add your handling code here:
        this.jpsw_codigo.requestFocus();
}//GEN-LAST:event_jtf_unidadlocalActionPerformed

    private void jpsw_codigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jpsw_codigoActionPerformed
        // TODO add your handling code here:
        if (this.jpsw_codigo.getText().length() > 0) {
            if (si_variables.getnivelusu()<6) {
                this.creachequeo(this.jpsw_codigo.getText().trim(),this.jtf_observacion.getText().trim().toUpperCase());
            } else {
                x.estableceConexion();
                if(si_variables.getError_ingreso()==-1) {
                    if(JOptionPane.showConfirmDialog(null, "Error! Servidor No responde,Desea Guardar su Registro de Forma Local?")==0) {
                        String ingresanombre=JOptionPane.showInputDialog("Ingrese su Nombre como Referencia:");
                        this.proceso_local_datos(ingresanombre);
                    }
                } else {
                    if(sihayregistros==1) {
                        this.datos_checklocales_update();
                    }
                    this.creachequeo(this.jpsw_codigo.getText().trim(),this.jtf_observacion.getText().trim().toUpperCase());
                    x.cierraConexionv2(si_variables.getconexiongral());
                }
            }
        }
}//GEN-LAST:event_jpsw_codigoActionPerformed

    private void jtf_observacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_observacionActionPerformed
        // TODO add your handling code here:
        this.jpsw_codigo.requestFocus();
}//GEN-LAST:event_jtf_observacionActionPerformed

    private void jbtn_buscarasistenciacodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarasistenciacodigoActionPerformed
        // TODO add your handling code here:
        this.jep_tareas.setText("");
        if (si_variables.getnivelusu()<6) {
            this.carga_datos_asistencia_detalle(14, this.jpwd_codigorevision.getText().trim(), this.fechaamericana(this.jdc_fechaingreso.getDate()), "");
        } else {
            x.estableceConexion();
            this.carga_datos_asistencia_detalle(14, this.jpwd_codigorevision.getText().trim(), this.fechaamericana(this.jdc_fechaingreso.getDate()), "");
            x.cierraConexionv2(si_variables.getconexiongral());
        }
}//GEN-LAST:event_jbtn_buscarasistenciacodigoActionPerformed

    private void jpwd_codigorevisionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jpwd_codigorevisionActionPerformed
        // TODO add your handling code here:
        this.jbtn_buscarasistenciacodigoActionPerformed(evt);
}//GEN-LAST:event_jpwd_codigorevisionActionPerformed

    private void jbtn_imprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_imprimirActionPerformed
        // TODO add your handling code here:
        this.imprimir_checcom(this.jtf_id.getText());
}//GEN-LAST:event_jbtn_imprimirActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:

        x.estableceConexion();
        if(sihayregistros==1) {
            this.datos_checklocales_update();
        }
        x.cierraConexionv2(si_variables.getconexiongral());
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jbtn_verdatoslocalesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_verdatoslocalesActionPerformed
        // TODO add your handling code here:
        this.cargar_datos_checklocales();
}//GEN-LAST:event_jbtn_verdatoslocalesActionPerformed

    private void jbtn_buscarasistenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarasistenciaActionPerformed
        // TODO add your handling code here:
        if (si_variables.getnivelusu()<6) {
            if((!si_variables.getLogin().equals("isaac"))  && (!si_variables.getLogin().equals("jesus"))   && (!si_variables.getLogin().equals("sae1"))   && (!si_variables.getLogin().equals("david")) && (!si_variables.getLogin().equals("nelson")) && (!si_variables.getLogin().equals("josue")) && (!si_variables.getLogin().equals("recepcion"))) {
                this.carga_datos_asistencia_detalle(14, this.jtf_busqueda.getText(), this.fechaamericana(this.jdc_fechaingreso.getDate()), "");
            }
        } else {
            //x.estableceConexion();
            //this.carga_datos_asistencia_detalle(6, this.jtf_busqueda.getText(), this.fechaamericana(this.jdc_fechaingreso.getDate()), "");
            //x.cierraConexionv2(variables_global.getconexiongral());
        }

    }//GEN-LAST:event_jbtn_buscarasistenciaActionPerformed

    private void jdc_fechaingresoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jdc_fechaingresoKeyPressed
        // TODO add your handling code here:
}//GEN-LAST:event_jdc_fechaingresoKeyPressed

    private void jbtn_generareporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_generareporteActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Generar Reporte?")==0) {
            String depa[]=this.jtf_tiendaactual.getText().split(":");

            if (si_variables.getnivelusu()<6) {
                this.iniciar_modelo_columnas(this.jdc_fechainicial.getDate(), this.jdc_fechafinal.getDate());
                this.carga_datos_empleado(4,depa[0]);
                this.carga_datos_tareaxdia(3,depa[0],this.fechaamericana(this.jdc_fechainicial.getDate()),this.fechaamericana(this.jdc_fechafinal.getDate()));
            } else {
                x.estableceConexion();
                this.iniciar_modelo_columnas(this.jdc_fechainicial.getDate(), this.jdc_fechafinal.getDate());
                this.carga_datos_empleado(4,depa[0]);
                this.carga_datos_tareaxdia(3, depa[0],this.fechaamericana(this.jdc_fechainicial.getDate()),this.fechaamericana(this.jdc_fechafinal.getDate()));
                x.cierraConexionv2(si_variables.getconexiongral());
            }
        }
}//GEN-LAST:event_jbtn_generareporteActionPerformed

    private void jrbtn_estasemanaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_estasemanaActionPerformed
        // TODO add your handling code here:
        Calendar fechainisem = Calendar.getInstance(); // obtiene la fecha actual
        Calendar fechafinsem = Calendar.getInstance(); // obtiene la fecha actual
        int diadesemana=fechainisem.get(Calendar.DAY_OF_WEEK)-2;

        System.out.println(diadesemana);
        fechainisem.add(Calendar.DATE, -diadesemana); // incrementa en 30 días la fecha actual.
        this.jdc_fechainicial.setDate(fechainisem.getTime());

        fechafinsem.add(Calendar.DATE, (6-diadesemana)); // incrementa en 30 días la fecha actual.
        this.jdc_fechafinal.setDate(fechafinsem.getTime());
}//GEN-LAST:event_jrbtn_estasemanaActionPerformed

    private void jrbtn_semanaproximaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_semanaproximaActionPerformed
        // TODO add your handling code here:
        Calendar fechainisem = Calendar.getInstance(); // obtiene la fecha actual
        int diadesemana=fechainisem.get(Calendar.DAY_OF_WEEK)-2;
        System.out.println(diadesemana);
        fechainisem.add(Calendar.DATE, 7-diadesemana); // incrementa en 30 días la fecha actual.
        this.jdc_fechainicial.setDate(fechainisem.getTime());
        fechainisem.add(Calendar.DATE, 6); // incrementa en 30 días la fecha actual.
        this.jdc_fechafinal.setDate(fechainisem.getTime());
}//GEN-LAST:event_jrbtn_semanaproximaActionPerformed

    private void jckb_noeliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jckb_noeliminarActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jckb_noeliminarActionPerformed

    private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
        // TODO add your handling code here:
        indice=this.jTabbedPane1.getSelectedIndex();
        switch(indice) {
            case 0:
                break;
            case 1:
                this.cargar_datos_checklocales();
                break;
            case 2:

                break;
            case 3:
                if (si_variables.getnivelusu()<6) {
                    this.iniciar_modelo_depaenlistac();
                } else {
                    if(carga>0) {
                        x.estableceConexion();
                        this.iniciar_modelo_depaenlistac();
                        x.cierraConexionv2(si_variables.getconexiongral());
                    }
                }
                break;

        }
}//GEN-LAST:event_jTabbedPane1StateChanged
   private void jlst_clientesdistribucionMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new supervision_rh_asistencia_checador().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtn_buscarasistencia;
    private javax.swing.JButton jbtn_buscarasistenciacodigo;
    private javax.swing.JButton jbtn_generareporte;
    private javax.swing.JButton jbtn_imprimir;
    private javax.swing.JButton jbtn_verdatoslocales;
    private javax.swing.JCheckBox jcbx_vertareasindi;
    private javax.swing.JCheckBox jckb_noeliminar;
    private com.toedter.calendar.JDateChooser jdc_fechafinal;
    private com.toedter.calendar.JDateChooser jdc_fechaingreso;
    private com.toedter.calendar.JDateChooser jdc_fechainicial;
    private javax.swing.JEditorPane jep_fotoempleado;
    private javax.swing.JEditorPane jep_tareas;
    private javax.swing.JLabel jlbl_describepuntualidad;
    private javax.swing.JLabel jlbl_resultado;
    private javax.swing.JLabel jlbl_resultado1;
    private javax.swing.JList jlst_clientesdistribucion;
    private javax.swing.JPasswordField jpsw_codigo;
    private javax.swing.JPasswordField jpwd_codigorevision;
    private javax.swing.JRadioButton jrbtn_estasemana;
    private javax.swing.JRadioButton jrbtn_semanaproxima;
    private javax.swing.JTable jt_historialasistencia;
    private javax.swing.JTable jt_historialasistencia_detalle;
    private javax.swing.JTable jt_historialasistencia_detalle1;
    private javax.swing.JTable jtbl_detalleapartado;
    private javax.swing.JTextField jtf_busqueda;
    private javax.swing.JTextField jtf_fechachequeo;
    private javax.swing.JTextField jtf_horaregistro;
    private javax.swing.JTextField jtf_horarioentro;
    private javax.swing.JTextField jtf_horarioentro1;
    private javax.swing.JTextField jtf_horarioentro2;
    private javax.swing.JTextField jtf_horariosalida;
    private javax.swing.JTextField jtf_horariosalida1;
    private javax.swing.JTextField jtf_horariosalida2;
    private javax.swing.JTextField jtf_id;
    private javax.swing.JTextField jtf_mincomida;
    private javax.swing.JTextField jtf_nombrecolaborador;
    private javax.swing.JTextField jtf_nombrecolaboradorprogramado;
    private javax.swing.JTextField jtf_observacion;
    private javax.swing.JTextField jtf_tiendaactual;
    private javax.swing.JTextField jtf_unidadlocal;
    // End of variables declaration//GEN-END:variables
//private com_distri_folios_imprimir objimpresora;
}
